package mi919;

import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author tmh
 * @date 2024/9/19 15:55
 * @description
 */
public class T01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        while (num>0){
            int N = scanner.nextInt();
            //n个大小为a[i]的玩具
            int n = scanner.nextInt();
            int count = scanner.nextInt();
            int[] nums = new int[n + count];
            int len = nums.length;
            Arrays.fill(nums, 1);
            for (int i = 0; i < n; i++) {
                nums[i] = scanner.nextInt();
            }
            int[][] dp = new int[len][N + 1];
            //赋值第一行初始值
            for (int i = nums[0]; i <= N; i++) {
                dp[0][i] = nums[0];
            }
            //数量和价值是一样的
            for (int i = 1; i < len; i++) {
                for (int j = 0; j <= N; j++) {
                    if (nums[i]>j){
                        dp[i][j]=dp[i-1][j];
                    }else {
                        dp[i][j]=Math.max(dp[i-1][j],dp[i-1][j-nums[i]]+nums[i]);
                    }
                }
            }
            if (dp[len-1][N]==N){
                System.out.println("YES");
            }else {
                System.out.println("NO");
            }
            num--;
        }
    }
}
